package com.example.arithmeticleetcode.leetcode.September;

/**
 * @program: arithmetic-leetcode
 * @description:
 * @author: FangZhen
 * @create: 2020-09-07 09:09
 **/
public class Demo06 {

    public static void main(String[] args) {

    }

    public static String modifyString(String s) {
        int n = s.length();
        char[] sb = s.toCharArray();
        for (int i = 0; i < n; i++) {
            if (s.charAt(i) == '?') {
                char a = 'a';
                while ((i > 0 && sb[i - 1] == a) || (i < n - 1 && sb[i + 1] == a)) {
                    a++;
                }
                sb[i] = a;
            }
        }
        return new String(sb);
    }
}
